package com.sky.mapper;

import com.sky.dto.ShoppingCatDTO;
import com.sky.entity.ShoppingCatEntity;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ShoppingCatMapping {

    List<ShoppingCatEntity> list(ShoppingCatEntity catEntity);

    @Update("update shopping_cart set number = #{number} where id = #{id}")
    void updateWithNumberById(@Param("id") Long id, @Param("number") Integer number);

    @Insert("insert into shopping_cart (name,image,user_id,dish_id,setmeal_id,dish_flavor,number,amount,create_time) values (#{name},#{image},#{userId},#{dishId},#{setmealId},#{dishFlavor},#{number},#{amount},#{createTime})")
    void insert(ShoppingCatEntity entity);

    void inserttBatch(List<ShoppingCatEntity> list);

    @Delete("delete from shopping_cart where user_id = #{id}")
    void clean(Long id);

    void sub(ShoppingCatEntity entity);
}
